<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	document.body.style.background = localStorage.getItem("bg");
	window.addEventListener("storage",(e)=>{
		console.log("当storage数据发生更改即被触发！",e)
		// 如果key为bg的值发生更改
		if(e.key === "bg"){
			document.body.style.background = e.newValue;
		}
	})
</script>
</html>